home *** CD-ROM | disk | FTP | other *** search
/ Ubisoft Digital Press Ki….S.A./North America (USA) / Ubisoft Digital Press Kit 99 U.S.A.-North America (USA).bin / Dcr / language2.cst / 00037_Script_Scroll Arrow Beh contact < prev    next >
Text File  |  1999-05-03  |  2KB  |  86 lines

  1.  
  2.  
  3. -- Scroll Arrow Behavior
  4.  
  5. ----------------------------------------------------------------
  6. -- This behavior tells the Text behavior a user has clicked an
  7. -- arrow button and that the Text behavior should therefore 
  8. -- scroll the text. You attach this behavior to an arrow
  9. -- button.
  10. --
  11. -- 10/1/97 David Benman
  12. ----------------------------------------------------------------
  13.  
  14.  
  15. -- pDirection - the type of button, up or down the
  16. -- behavior is attached to
  17. -- pScrollDelay-the number of ticks the behavior waits after
  18. -- you click the arrow button and before the text starts
  19. -- scrolling.
  20. -- pClickedStatus - a boolean indicating if the 
  21. -- behavior's button has been clicked.
  22. property pScrollDelayc, pClickedStatusc, pDirectionc
  23.  
  24.  
  25. -- This handler determines if the button it is
  26. -- attached to is an up or down button.
  27. on beginSprite me
  28.   
  29.   set pScrollDelayc to 10
  30.   
  31.   -- Checks if the name of sprite you clicked is 
  32.   -- an up or down button.
  33.   set currentMember to the member of sprite the spriteNum of me
  34.   if the name of member currentMember contains "up" then
  35.     set pDirectionc to #up
  36.   else
  37.     set pDirectionc to #down
  38.   end if 
  39. end
  40.  
  41.  
  42. -- The mouseDown handler sends the scrollText message to all 
  43. -- the sprites in the current frame when you click an arrow 
  44. -- button. The text behavior contains a scrollText handler 
  45. -- designed to receive the message and scroll the text. The 
  46. -- mouseDown handler also starts the timer for use by the 
  47. -- following mouseWithin handler.
  48. on mouseDown me
  49.   set pClickedStatusc to 1
  50.   sendAllSprites(#scrollTextc, pDirectionc)
  51.   startTimer
  52. end
  53.  
  54. on mouseLeave me
  55.   set pClickedStatusc to 0
  56. end
  57.  
  58. on mouseUp me
  59.   set pClickedStatusc to 0
  60.   
  61. end
  62.  
  63.  
  64. -- The mouseWithin handler checks if the mouse button is still 
  65. -- pressed and that the timer is less than the preset scroll 
  66. -- delay time. This allows you to click and hold an arrow button 
  67. -- to continoously scroll. Also, the delay allows you to click 
  68. -- and release an arrow button within the delay time to scroll 
  69. -- the text a fixed amount, one line in this example.
  70. --
  71. -- So, this handler tells the text behavior to scroll if you 
  72. -- have clicked and held the arrow button for longer than the 
  73. -- scroll delay time.
  74.  
  75. on mouseWithin me
  76.   if pClickedStatusc = 1 then
  77.     if the mouseDown AND the timer > pScrollDelayc then
  78.       sendAllSprites(#scrollTextc, pDirectionc)
  79.     end if
  80.   end if
  81.   
  82. end
  83.  
  84.  
  85.  
  86.